function loginjs(){
    $(".alerter").one("click", function () {
        $(this).show();
    });
    $(".alerter").trigger("click");
    $(".btns>button").eq(0).click(function () {
        console.log("a")
        $(".alerter").hide();
    });
    $(".btns>span").click(function () {
        location.href = "../index.html";
    })
    $(".shoujihao input").eq(0).click(function () {
        $(this).attr("placeholder", "");
        $(".tishixinxi").show();
        return false;
    });
    $("body").click(function () {
        $(".shoujihao input").eq(0).attr("placeholder", "建议使用常用手机号");
        $(".tishixinxi").hide();
        return false;
    });


    var cart = new Cart();
    $(".cont23-1").click(function () {
        let reg1 = /^1(3|4|5|6|7|8|9)\d{9}$/;
        let val1 = $(".shoujihao-1").val();
        
        if (reg1.test(val1)) {
            cart.saveponber(val1);
            $(".sjhzc-1").hide();
            $(".sjhzc-2").show();
            $(".cont1>ul>li").eq(2).addClass("tongbu").siblings().removeClass("tongbu")
        } else {
            $(".shoujihao-1").val("格式错误");
        }
    });


    $(".cont23-2>div").click(function(){
        localStorage.setItem("username",JSON.stringify($(".username").val()));
        localStorage.setItem("password",JSON.stringify($(".password").val()));
        $.ajax({
            url:"http://jx.xuzhixiang.top/ap/api/reg.php",
            type:"get",
            data:{
                username:$(".username").val(),
                password:$(".password").val(),
            },
            success:function(data){
                console.log(data);
                if(data.code==1){
                    alert("注册成功")
                    location.href="register.html"
                }else{
                    alert("用户名已存在")
                }
                
            }
        })
    })















 
}










function Cart(){
     if(localStorage.getItem("ponber")){
        this.ponber=JSON.parse(localStorage.getItem("ponber"))
    }else{
        this.ponber={}
    }

}
Cart.prototype.saveponber=function(val1){
    if(this.ponber[val1]==undefined){
        this.ponber[val1]=1;
    }else{
        this.ponber[val1]++;
    }
    localStorage.setItem("ponber", JSON.stringify(this.ponber));
}
   























